<%@ Page Language="C#" MasterPageFile="~/master/admin.master" AutoEventWireup="true"
    CodeFile="product-category-edit.aspx.cs" Inherits="admin_product_category_edit"
    ValidateRequest="false" %>

<%@ Register Namespace="ECommerce.Library.Web" TagPrefix="ucc" %>
<%@ Register Src="~/controls/wucAdminValidator.ascx" TagName="AdminValidator" TagPrefix="wuc" %>
<asp:Content ID="cntMiddleContent" ContentPlaceHolderID="cphMiddleContent" runat="Server">
    <div class="admin-function-top">
        <ucc:ResponseMessage ID="uccResponseMessage" runat="server"></ucc:ResponseMessage>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
            DisplayMode="BulletList" ShowMessageBox="true" HeaderText="Please correct the following:"
            CssClass="adminValidator" />
        <fieldset>
            <label>
                Category Name</label>
            <asp:TextBox ID="tbxCategoryName" runat="server" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvCategoryName" runat="server" ControlToValidate="tbxCategoryName"
                ErrorMessage="Category Name is required" Display="dynamic" SetFocusOnError="true"><br />
            </asp:RequiredFieldValidator><br />
            <label>
                Select Parent Category</label>
            <asp:DropDownList ID="ddlParent" runat="server">
            </asp:DropDownList>
            <br />
            <label>
                Display Order</label>
            <asp:TextBox ID="tbxDisplayOrder" runat="server" Width="52px" CssClass="text"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvDisplayOrder" runat="server" ControlToValidate="tbxDisplayOrder"
                ErrorMessage="Display Order is required" Display="dynamic" SetFocusOnError="true">
                <wuc:AdminValidator ID="AdminValidator3" runat="server" />
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator runat="server" ID="revDisplayOrder" ControlToValidate="tbxDisplayOrder"
                EnableClientScript="true" ErrorMessage="Only number allowed" SetFocusOnError="true"
                ValidationExpression="^\d+$">
                <wuc:AdminValidator ID="Validator40" runat="server" />
            </asp:RegularExpressionValidator>
            <br />
            <asp:Image ID="imgCategoryImage" Height="100px" runat="server" /><br />
            <label>
                Category Image
            </label>
            <asp:FileUpload ID="fluCategoryLogo" runat="server" CssClass="text" /><br />
            <asp:CheckBox ID="cbxIsActive" runat="server" />
            <label>
                Active</label>
        </fieldset>
        <fieldset>
            <asp:Image ID="imgCategoryBannerImage" Height="100px" runat="server" /><br />
            <label>
                Category Banner Image</label>
            <asp:FileUpload ID="fluCategoryBanner" runat="server" CssClass="text" /><br />
        </fieldset>
        <fieldset>
            <label>
                Select Partner(s)</label>
            <asp:CheckBoxList ID="cbxPartners" runat="server" DataTextField="BrandName" DataValueField="ProductBrandId">
            </asp:CheckBoxList>
            <asp:CustomValidator runat="server" ID="cvlist" ClientValidationFunction="ValidatePartnerList"
                ErrorMessage="Please Select Atleast one Partner" Display="None">
            </asp:CustomValidator>
        </fieldset>
        <div class="btn-place-holder">
            <asp:Button ID="imgSaveBottom" runat="server" OnClick="Create_Click" CssClass="button medium black"
                Text="Save Category" ToolTip="Save Category" />
        </div>
    </div>
    <br class="clear" />
    <script type="text/javascript">
        function ValidatePartnerList(source, args) {
            var chkListPartners = document.getElementById('<%= cbxPartners.ClientID %>');
            var chkListinputs = chkListPartners.getElementsByTagName('input');
            for (var i = 0; i < chkListinputs.length; i++) {
                if (chkListinputs[i].checked) {
                    args.IsValid = true;
                    return;
                }
            }
            args.IsValid = false;
        }
    </script>
</asp:Content>
